<?php

// ini_set("display_errors", "On");
// error_reporting(E_ALL);

require_once '../base/header-iframe.php';
require_once '../../sql/connection.php';


$jobID = $_POST['jobID'];
$content = $_POST['content'];
$stuID = $_COOKIE['studentNum'];
$stuName = $_COOKIE['studentName'];

$now = date('Y-m-d H:i:s', time());
$insertSql = "INSERT INTO comment (create_time, update_time, is_delete, jobID, stu_ID, stu_name, content) VALUES ('$now','$now',0,'$jobID','$stuID','$stuName','$content')";

if (mysqli_query($GLOBALS['conn'], $insertSql)) {
	echo "
            <script>
                alert('发表成功！');
                window.location.href=document.referrer;
            </script>
        ";
} else {
	echo "
            <script>
                alert('发表失败！');
                history.back();
            </script>
        ";
}